import { FormSchema } from '/@/components/Table';
import { uploadApi } from '/@/api/sys/upload';
import { getAllList } from '/@/api/privilege/account';
import { getDepts as getAllDept } from '/@/api/org/dept';

/**
 * 公用表单字段定义
*/
export const formSchemaCommon: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'delivery.contract.formNo',
    label: '合同编号',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.contract.clientName',
    label: '委托单位',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.itemName',
    label: '委托业务',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.contract.clientManager',
    label: '联系人及电话',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.contract.clientAddress',
    label: '地址',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.contract.contractBegin',
    label: '开始服务期限',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.contract.contractEnd',
    label: '结束服务期限',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.serviceType',
    label: '服务方式',
    component: 'Select',
    componentProps: {
      disabled: true,
      options: [
        {
          label: '按次',
          value: '按次',
          key: '1',
        },
        {
          label: '按月',
          value: '按月',
          key: '2',
        },
        {
          label: '按季',
          value: '按季',
          key: '3',
        },

      ],
    },
  },
  {
    field: 'delivery.serviceFrequency',
    label: '服务频次',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },

];

/**
 * 1、采样：表单字段定义
*/
export const formSchema1: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'delivery.isUpload',
    label: '相关资料是否已上传政务网',
    component: 'Select',
    componentProps: {
      disabled: true,
      options: [
        {
          label: '是',
          value: 1,
          key: 1,
        },
        {
          label: '否',
          value: 0,
          key: 0,
        },

      ],
    },
  },
  {
    field: 'collectInformed',
    label: '外包单位是否已联系',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: 1,
        },
        {
          label: '否',
          value: 0,
          key: 0,
        },
        {
          label: '无外包单位',
          value: -1,
          key: -1,
        },
      ],
    },
  },
  {
    field: 'collectTime',
    label: '采样日期',
    required: true,
    component: 'DatePicker',
  },
  {
    field: 'collectFinished',
    label: '本次采样是否全部完成',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: 1,
        },
        {
          label: '否',
          value: 0,
          key: 0,
        },
        {
          label: '未采样',
          value: -1,
          key: -1,
        },
      ],
    },
  },
  {
    field: 'collectResultList',
    label: '采样结果',
    component: 'Upload',
    colProps: { span: 24 },
    componentProps: {
      api: uploadApi,
    },

  },
  {
    field: 'collectRemark',
    label: '采样备注',
    component: 'InputTextArea',
  },
  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },


];


/**
 * 2、收样：表单字段定义
*/
export const formSchema2: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'collectTime',
    label: '采样时间',
    component: 'DatePicker',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'acceptTime',
    label: '样品接收时间',
    component: 'DatePicker',
    required: true,
  },

  {
    field: 'acceptRemark',
    label: '收样备注',
    component: 'InputTextArea',
  },
  {
    field: 'collectRemark',
    label: '采样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },


];


/**
 * 3、实验派工：表单字段定义
*/
export const formSchema3: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'acceptTime',
    label: '样品接收日期',
    component: 'DatePicker',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'libReportManager',
    label: '报告编制人员',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },
  {
    field: 'libAnalysisList',
    label: '实验分析人员',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      mode: "multiple",
      labelField: 'realName',
      valueField: 'id',
    }
  },


];


/**
 * 4、实验分析：表单字段定义
*/
export const formSchema4: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'collect.delivery.contract.formNo',
    label: '合同编号',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.contract.clientName',
    label: '委托单位',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.itemName',
    label: '委托业务',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.contract.clientManager',
    label: '联系人及电话',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.contract.clientAddress',
    label: '地址',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.contract.contractBegin',
    label: '开始服务期限',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.contract.contractEnd',
    label: '结束服务期限',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.serviceType',
    label: '服务方式',
    component: 'Select',
    componentProps: {
      disabled: true,
      options: [
        {
          label: '按次',
          value: '按次',
          key: '1',
        },
        {
          label: '按月',
          value: '按月',
          key: '2',
        },
        {
          label: '按季',
          value: '按季',
          key: '3',
        },

      ],
    },
  },
  {
    field: 'collect.delivery.serviceFrequency',
    label: '服务频次',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.planId',
    label: '采样计划及委托依据',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },

  {
    field: 'collect.acceptTime',
    label: '样品接收日期',
    component: 'Input',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'manager',
    label: '实验分析人员',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      disabled: true,
      api: getAllList,
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },
  {
    field: 'finishTime',
    label: '分析完成日期',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
  },

  {
    field: 'collect.acceptRemark',
    label: '收样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.collectRemark',
    label: '采样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collect.delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },

  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },
];

/**
 * 5、实验报告：表单字段定义
*/
export const formSchema5: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'acceptTime',
    label: '样品接收日期',
    component: 'DatePicker',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'libReportTime',
    label: '报告完成日期',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'libReportList',
    label: '实验数据报告',
    component: 'Upload',
    colProps: { span: 24 },
    componentProps: {
      api: uploadApi,
    },
  },
  {
    field: 'askForReport',
    label: '催办',
    component: 'Input',
    slot: 'askForReportSlot',
  },
  {
    field: 'libRemark',
    label: '备注',
    component: 'InputTextArea',
  },

  {
    field: 'acceptRemark',
    label: '收样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collectRemark',
    label: '采样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'libProgress',
    label: '实验进度',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },

];

/**
 * 6、交付：表单字段定义
*/
export const formSchema6: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'handoverTime',
    label: '领用日期',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'handoverRemark',
    label: '备注',
    component: 'InputTextArea',
  },

  {
    field: 'libRemark',
    label: '实验备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'acceptRemark',
    label: '收样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'collectRemark',
    label: '采样备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },


];


/**
 * 7、办公室结算：表单字段定义
*/
export const formSchema7: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'closeUnfinished',
    label: '相关业务是否完成',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: 1,
        },
        {
          label: '否',
          value: 0,
          key: 0,
        },

      ],
    },
  },
  {
    field: 'closeDeptRemark',
    label: '备注',
    component: 'InputTextArea',
  },



];

/**
 * 8、财务结算：表单字段定义
*/
export const formSchema8: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'closeUnfinished',
    label: '相关业务是否完成',
    required: true,
    component: 'Select',
    componentProps: {
      disabled: true,
      options: [
        {
          label: '是',
          value: 1,
          key: 1,
        },
        {
          label: '否',
          value: 0,
          key: 0,
        },

      ],
    },
  },
  {
    field: 'closeDeptRemark',
    label: '办公室结算备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'closeTime',
    label: '结算日期',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'closeRemark',
    label: '备注',
    component: 'InputTextArea',
  },



];

/**
 * 9、归档：表单字段定义
*/
export const formSchema9: FormSchema[] = [
  ...formSchemaCommon,


  {
    field: 'delivery.id',
    label: '派工单id',
    component: 'Input',
    show: false,
  },
  {
    field: 'delivery.archiveNo',
    label: '档案编号',
    component: 'Input',
    required: true,
  },
  {
    field: 'delivery.archiveFileList',
    label: '附件',
    component: 'Upload',
    colProps: { span: 24 },
    componentProps: {
      api: uploadApi,
    },
  },
  {
    field: 'delivery.archiveRemark',
    label: '备注',
    component: 'InputTextArea',
  },

];

/**
 * 10、职业卫生场调：表单字段定义
*/
export const formSchema10: FormSchema[] = [
  ...formSchemaCommon,


  {
    field: 'delivery.id',
    label: '派工单id',
    component: 'Input',
    show: false,
  },

  {
    field: 'surveyPlan',
    label: '采样计划是否已编制完成',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: '1',
        },
        {
          label: '否',
          value: 0,
          key: '0',
        },
      ],
    },
  },
  {
    field: 'surveyReason',
    label: '委托依据是否已编制完成',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: '1',
        },
        {
          label: '否',
          value: 0,
          key: '0',
        },
      ],
    },
  },

  {
    field: 'delivery.surveyAccept',
    label: '采样接收部门',
    component: 'ApiSelect',
    componentProps: {
      api: getAllDept,
      showSearch: true,
      optionFilterProp: 'label',
      resultField: 'data',
      labelField: 'name',
      valueField: 'id',
    },
    required: true,
  },

  {
    field: 'surveyRemark',
    label: '备注',
    component: 'InputTextArea',
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },

];

/**
 * 11、验收场调：表单字段定义
*/
export const formSchema11: FormSchema[] = [
  ...formSchemaCommon,


  {
    field: 'delivery.id',
    label: '派工单id',
    component: 'Input',
    show: false,
  },

  {
    field: 'surveyPlan',
    label: '采样计划是否已编制完成',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: '1',
        },
        {
          label: '否',
          value: 0,
          key: '0',
        },
      ],
    },
  },
  {
    field: 'surveyReason',
    label: '委托依据是否已编制完成',
    required: true,
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: '1',
        },
        {
          label: '否',
          value: 0,
          key: '0',
        },
      ],
    },
  },

  {
    field: 'delivery.surveyAccept',
    label: '采样接收部门',
    component: 'ApiSelect',
    componentProps: {
      api: getAllDept,
      showSearch: true,
      optionFilterProp: 'label',
      resultField: 'data',
      labelField: 'name',
      valueField: 'id',
    },
    required: true,
  },

  {
    field: 'surveyRemark',
    label: '备注',
    component: 'InputTextArea',
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },

];

/**
 * 12、报告编制：表单字段定义
*/
export const formSchema12: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'delivery.id',
    label: '派工单id',
    component: 'Input',
    show: false,
  },
  {
    field: 'reportTime',
    label: '编制完成时间',
    component: 'DatePicker',
    required: true,
  },

  {
    field: 'delivery.reportFileList',
    label: '公示材料',
    component: 'Upload',
    colProps: { span: 24 },
    componentProps: {
      api: uploadApi,
    },
  },
  {
    field: 'delivery.reportRemark',
    label: '备注',
    component: 'InputTextArea',
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },

];

/**
 * 13、公示：表单字段定义
*/
export const formSchema13: FormSchema[] = [
  ...formSchemaCommon,


  {
    field: 'delivery.id',
    label: '派工单id',
    component: 'Input',
    show: false,
  },

  {
    field: 'publishTime',
    label: '公示开始时间',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'publishFinishTime',
    label: '公示结束时间',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'publishRemark',
    label: '备注',
    component: 'InputTextArea',
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
];

/**
 * 14、现场服务：表单字段定义
*/
export const formSchema14: FormSchema[] = [
  ...formSchemaCommon,

  {
    field: 'serviceTime',
    label: '服务时间',
    component: 'DatePicker',
    required: true,
  },
  {
    field: 'serviceFile',
    label: '服务回执单',
    component: 'Upload',
    colProps: { span: 24 },
    componentProps: {
      api: uploadApi,
    },
  },
  {
    field: 'serviceRemark',
    label: '备注',
    component: 'InputTextArea',
  },
  {
    field: 'delivery.remark',
    label: '派工单备注',
    component: 'InputTextArea',
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'transferTo',
    label: '转交人员',
    component: 'ApiSelect',
    componentProps: {
      api: getAllList,
      showSearch: true,
      optionFilterProp: 'label',
      params: {},
      labelField: 'realName',
      valueField: 'id',
    }
  },

];

/**
 * 15、采样办公室：表单字段定义
*/
export const formSchema15: FormSchema[] = [
  ...formSchemaCommon,
  {
    field: 'delivery.id',
    label: '派工单id',
    component: 'Input',
    show: false,
  },
  {
    field: 'delivery.isUpload',
    label: '相关资料是否已上传政务网',
    component: 'Select',
    required: true,
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
          key: 1,
        },
        {
          label: '否',
          value: 0,
          key: 0,
        },

      ],
    },
  },

];